// // pages/commit_record/index.js
import API from "../../api/index";
Component({

  /**
   * 组件的初始数据
   */
  data: {
        start:0,
        count:6,
        list:[],
        total:0,
        showmore:false
      },
  /**
   * 组件的方法列表
   */
  methods: {
    __getRecordList(){
      if(this.data.list.length<this.data.total || (this.data.list.length<=this.data.total&&this.data.start==0)){
        API.getRecordList({start:this.data.start,count:this.data.count}).then(res=>{
          this.setData({
            list:[...(this.data.start == 0 ? [] : this.data.list),...res.data.items],
            total:res.data.total
          })
          this.setData({showmore:this.data.list.length<this.data.total?false:true})
        })
      }
    },
    
    skip(e){
      wx.navigateTo({
          url: "/pages/commit_detail/index?id="+e.currentTarget.dataset.id,
      })
   }
  },
  ready(){
    this.__getRecordList()
  },
})